package com.uphone.edwards.pro.activity.login;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.radish.baselibrary.Intent.IntentUtils;
import com.uphone.edwards.R;
import com.uphone.edwards.util.LanguageUtils;
import com.uphone.edwards.util.SharedUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class MineActivity extends AppCompatActivity {

    @BindView(R.id.tvLogOut)
    TextView tvLogOut;
    @BindView(R.id.tv_xiugaixinxi)
    TextView tvXiugaixinxi;
    @BindView(R.id.ll_mine)
    LinearLayout llMine;
    @BindView(R.id.tv_address_select)
    TextView tvAddressSelect;
    @BindView(R.id.et_username)
    EditText etUsername;
    @BindView(R.id.et_gonghao)
    EditText etGonghao;
    @BindView(R.id.et_zhicheng)
    EditText etZhicheng;
    @BindView(R.id.tv_save)
    TextView tvSave;
    @BindView(R.id.lv_address)
    ListView lvAddress;
    @BindView(R.id.ll_bianji)
    LinearLayout llBianji;
    @BindView(R.id.ll_return)
    LinearLayout llReturn;

    @Override
    protected void attachBaseContext(Context newBase) {
        //获取我们存储的语言环境 比如 "en","zh",等等
        /**
         * attach对应语言环境下的context
         */
        String lang = SharedUtils.getShareLanguage(newBase);
        super.attachBaseContext(LanguageUtils.attachBaseContext(newBase, lang));

    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mine);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.tvLogOut, R.id.tv_xiugaixinxi, R.id.tv_save, R.id.ll_return})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tvLogOut:
                IntentUtils.getInstance()
                        .with(this, LoginActivity.class)
                        .start();
                break;
            case R.id.tv_xiugaixinxi:
                llBianji.setVisibility(View.VISIBLE);
                llMine.setVisibility(View.GONE);
                break;
            case R.id.tv_save:
                llBianji.setVisibility(View.GONE);
                llMine.setVisibility(View.VISIBLE);
                break;
            case R.id.ll_return:
                finish();
                break;
        }
    }

}
